C = gcc
CFLAGS = -fpic -c
TARGET = libeasysmtp.so
OBJECTS = easysmtp.o error.o change64.o attach.o process_chain.o ssl.o
SRC = src/

.PHONY: all clean

all: $(TARGET)
$(TARGET): $(OBJECTS)
	$(CC) -shared -o $(TARGET) $(OBJECTS) -lssl
easysmtp.o: $(SRC)easysmtp.c $(SRC)easysmtp.h $(SRC)error.h $(SRC)change64.h \
		$(SRC)attach.h $(SRC)ssl.h
	$(CC) $(CFLAGS) $(SRC)easysmtp.c 
error.o: $(SRC)error.c $(SRC)error.h
	$(CC) $(CFLAGS) $(SRC)error.c
change64.o: $(SRC)change64.c $(SRC)change64.h
	$(CC) $(CFLAGS) $(SRC)change64.c
attach.o: $(SRC)attach.c $(SRC)attach.h $(SRC)easysmtp.h
	$(CC) $(CFLAGS) $(SRC)attach.c
process_chain.o: $(SRC)process_chain.c $(SRC)process_chain.h $(SRC)easysmtp.h
	$(CC) $(CFLAGS) $(SRC)process_chain.c
ssl.o: $(SRC)ssl.c $(SRC)ssl.h $(SRC)easysmtp.h $(SRC)process_chain.h
	$(CC) $(CFLAGS) $(SRC)ssl.c

clean:
	rm *.o $(TARGET)
